package com.trkj.property_controller;

import com.trkj.entity.HouseEntity;
import com.trkj.entity.RegionEntity;
import com.trkj.service.RegionService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@Slf4j
@CrossOrigin
public class RegionmanageController {
    @Autowired
    private RegionService regionService;
    @PostMapping("/selectRegion")
    public List<RegionEntity> selectAll(){
        return regionService.selectAll();
    }
    @PostMapping("/AddRegion")
    public Boolean AddRegion(@RequestBody RegionEntity region){
        return regionService.AddRegion(region);
    }
    @DeleteMapping("/delRegion")
    public Boolean delRegion(@RequestParam("id") int id){
        return regionService.deleteRegion(id);
    }
    @PutMapping("/updateRegion")
    public Boolean updateRegion(@RequestBody RegionEntity region){
        return regionService.updateRegion(region);
    }
}
